import pytest,time
from selenium.webdriver import Keys
from selenium.webdriver.common.by import By
from selenium import webdriver

@pytest.fixture
def driver():
    driver=webdriver.Edge()
    driver.maximize_window()
    driver.get('http://10.59.9.12:7001/')
    yield driver
    # 将驱动对象传递给测试用例
    time.sleep(3)
    driver.quit()

def test_a3mall_login(driver):
    driver.find_element(By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a').click()
    driver.find_element(By.NAME, 'username').send_keys('13012558376')
    driver.find_element(By.NAME,'password').send_keys('123456Aa')
    time.sleep(8)
    # 点击登录
    driver.find_element(By.CLASS_NAME, 'finish-btn').click()
    time.sleep(3)
    dy1 =driver.find_element(By.XPATH, '/html/body/div[1]/div/div[2]/ul/li[1]/a').text
    print("断言1：", dy1)
    time.sleep(1)
    dy2 =driver.find_element(By.XPATH, '/html/body/div[4]/a[2]').text
    print("断言2:", dy2)
    time.sleep(1)
    dy3 =driver.find_element(By.XPATH, '/html/body/div[5]/div[2]/div[1]/div[2]/div[2]/ul/li[4]/span').text
    dy31 =dy3.replace('¥ ', '')
    print("断言3：", dy31)
    time.sleep(1)
    assert '会员中心' in driver.title

def test_a3mall_login_02():
    pytest.main()
















